import Mock from 'mockjs'

const List = []
const count = 100

for (let i = 0; i < count; i++) {
  List.push(Mock.mock({
    id: '@increment',
    'ext1': '@cname', // 组织名称
    'ext2': '@string("lower", 5, 20)', // 组织代码
    'ext3': '@word(5)', // 描述
    'ext4': '@word(6)' // 操作
  }))
}

export default [
  {
    url: '/vue-element-admin/system/getDepartList',
    type: 'post',
    response: config => {
      const { page = 1, limit = 20 } = config.query

      const pageList = List.filter((item, index) => index < limit * page && index >= limit * (page - 1))

      return {
        code: 20000,
        data: {
          total: List.length,
          items: pageList
        }
      }
    }
  }
]
